PageInfo.register({"type": "plug","info": function(require) {
	 
		var FunUtil = {};

		FunUtil.layout = function(callback) {

            layui.use(['form', 'layedit', 'laydate', 'laypage', 'layer',"upload"], function () {
                var form = layui.form(), layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate,
                    laypage = layui.laypage, layer = layui.layer;
                    form.render('');
                var param = {"form":form,"layer":layer,"laypage":laypage,"upload":layui.upload};
                callback(param)
            });
        };
        FunUtil.memory = function() {


            var memory = {
                financingType:{
                    "1":"preA",
                    "2":"A",
                    "3":"A+",
                    "4":"B",
                    "5":"B+",
                    "6":"无融资"
                },
                companyType:{
                    "1":"民营",
                    "2":"国企",
                    "3":"外企",
                    "4":"其他"
                },
				dataType:{
					1001:1001	,//企业类型
                    1002:1002	,//融资情况
                    1003:1003	,//性别
                    1004:1004	,//职位类别
                    1005:1005	,//学历
                    1006:1006	,//账号类型
                    1007:1007	,//是否启用
                    1008:1008	,//工作经验
                    1009:1009	,//行业类型
                    1010:1010	,//公司规模
				}
				
				
				
            };

            return memory;
        };
		
		FunUtil.selectBuffer = function(data){
			var buf  = [];
			var list = data.list;
			
			//数据分组
			
			if(String.HasText(data.type)){
				
				if(data.type == "hr"){
					
				    for(var i =0,len = list.length;i<len;i++){
				      var obj = list[i];
				      var isselect = ((String.HasText(data.key) && data.key == obj.id) ? "selected":"");
				      if(isselect){
				      	buf.push(' <option value="'+obj.id+'"  selected>'+obj.contractorName+'</option>');
				      }else{
				      	buf.push(' <option value="'+obj.id+'" >'+obj.contractorName+'</option>');
				      }
			        }
					
					
				}else{
					
					for(var i =0,len = list.length;i<len;i++){
				      var obj = list[i];
				      var isselect = ((String.HasText(data.key) && data.key == obj.code) ? "selected":"");
				      if(isselect){
				      	buf.push(' <option value="'+obj.code+'"  selected>'+obj.regionName+'</option>');
				      }else{
				      	buf.push(' <option value="'+obj.code+'" >'+obj.regionName+'</option>');
				      }
			        }
					
				}
				
				
				
				 
				
			}else{
				var key  = data.key;
				for(var i =0,len = list.length;i<len;i++){
				  var obj = list[i];
				  if(obj.dictTypeCode == key ){
				 
				  	if((String.HasText(data.select) && data.select == obj.dictdataCode)){
				  		buf.push(' <option value="'+obj.dictdataCode+'" selected>'+obj.dictdataName+'</option>');
				  		
				  	}else{
				  		
				  		buf.push(' <option value="'+obj.dictdataCode+'">'+obj.dictdataName+'</option>');
				  	}
				  }
			    }
			}
			
			var result = buf.join("");
			
			if(!String.HasText(result)) result = "";
			
			
			
			return result;
		};
		
		FunUtil.filter = function(){
		 var access_token = localStorage.getItem("auth");
		 var nurl         = window.location.href;
		 $("div.admin-company-head").show();
		 $("body").delegate("form","submit",function(e){
            if(e.target.className != "ntq-uplad-file") return false;
		 });
         if(!String.HasText(access_token) && nurl.indexOf("#") > 0 )  window.location.href = (nurl+"").split("#")[0]
			
			
		};
		
		FunUtil.editer = function(data){
			
			var E = window.wangEditor
            var editor = new E('#'+data.id+"-edit");
            var $vid  = document.getElementById(data.id);
            
            editor.customConfig.menus = [
               'head',  // 标题
               'bold',  // 粗体
               'italic',  // 斜体
              /* 'underline',  // 下划线
               'strikeThrough',  // 删除线
               'foreColor',  // 文字颜色
               'backColor',  // 背景颜色
               'link',  // 插入链接
               'list',  // 列表
               'justify',  // 对齐方式
               'quote',  // 引用
               'emoticon',  // 表情
               'image',  // 插入图片
               'table',  // 表格
               'video',  // 插入视频
               'code',  // 插入代码
               'undo',  // 撤销
               'redo'  // 重复*/
            ];
            editor.customConfig.onchange = function (html) {
            	$vid.value = (html);
            };
            
            editor.create()
            if(String.HasText(data.value)){
            	$vid.value = data.value;
            	editor.txt.html(data.value)
            }
            
			
		};
		 
		return FunUtil;
}});